const { Model , DataTypes } = require('sequelize');

const sequelize = require('../db/conn.js');

class Course extends Model {
}

const attributes = {
    id: {
        type: DataTypes.INTEGER,
        autoIncrement: true,
        primaryKey: true,
        field: `id`
    },
    // 指定属性类型
    name: DataTypes.STRING,
    // 等同于 credit: { type: DataTypes.FLOAT }
    credit: DataTypes.FLOAT,
}

const options = {
    tableName: 't_courses',
    sequelize: sequelize ,
    timestamps: false
}

Course.init( attributes , options );

module.exports = Course ;